/*------------------------------------------------------------------------
//                          Project CommonLib                           //
------------------------------------------------------------------------*/

#include "stdafx.h"
#include "CmIni.h"

int GetIntByini( TCHAR* tagName, TCHAR* idxName, const wchar_t* strIniPath, int defultVal)
{
    return ::GetPrivateProfileInt( tagName, idxName, defultVal, strIniPath);        
}

bool GetStringByini( TCHAR* tagName, TCHAR* idxName, const wchar_t* strIniPath, std::wstring& getString OUT)
{        
	static TCHAR contentString[0xffff] = {0,};
    if( 0==::GetPrivateProfileString( tagName, idxName, NULL, contentString, 0xffff, strIniPath) )
        return false;
	getString  = contentString;
    return true;
}

//////////////////////////////////////////////////////////////////////////
// CmIni
//////////////////////////////////////////////////////////////////////////
CmIni::CmIni(TCHAR* pFilename)        
{   
	m_fileName= pFilename;
}

CmIni::~CmIni()
{        
}

int CmIni::GetInt( TCHAR* tagName, TCHAR* idxName)
{
	return GetIntByini(tagName, idxName, m_fileName.c_str() );
}

bool CmIni::GetString( TCHAR* tagName, TCHAR* idxName, std::wstring& getString OUT)
{
	return GetStringByini( tagName, idxName, m_fileName.c_str(), getString);
}


/*------------------------------------------------------------------------

------------------------------------------------------------------------*/
